<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="utf-8">
    <title>作业提交</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <link rel="stylesheet" href="../../xznstatic/css/common.css" />
    <link rel="stylesheet" href="../../xznstatic/css/style.css" />
    <script type="text/javascript" src="../../xznstatic/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="../../xznstatic/js/jquery.SuperSlide.2.1.1.js"></script>
    <link rel="stylesheet" href="../../xznstatic/css/bootstrap.min.css" />
    <link rel="stylesheet" href="../../css/theme.css" />
</head>
<style>
    .center-container {
        width: 1200px;
        margin: 0 auto;
        margin-top: 20px;
        display: flex;
        margin-bottom: 20px;
    }

    .proleft {
        width: 280px;
        background: #fff;
        padding-top: 30px;
    }

    .proleft .lefttit-bg {
        background: var(--publicMainColor);
        width: 90%;
        padding-left: 20px;
        padding-bottom: 10px;
    }

    .proleft .p1 {
        font-size: 25px;
        font-weight: bold;
        color: var(--publicMainColor);
        padding-left: 40px;
        line-height: 1;
        padding-bottom: 10px;
    }

    .proleft .p2 {
        font-size: 26px;
        font-weight: bold;
        color: #fff;
    }

    .proleft .p3 {
        font-size: 18px;
        font-weight: bold;
        color: #fff;
    }

    .fl {
        float: left;
    }

    .fr {
        float: right;
    }

    .ul1 {
        padding-left: 27px;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .ul1 li {
        position: relative;
    }

    .ul1 li {
        font-size: 15px;
        color: #000;
        padding: 10px 0px 10px 35px;
        display: block;
        transition: all 0.6s;
    }

    .ul1 li b {
        display: block;
        position: absolute;
        left: 0;
        width: 10px;
        height: 1px;
        background: #aaaaaa;
        top: 50%;
        transform: translateY(-50%);
        transition: all 0.6s;
    }

    .ul1 li.on b,
    .ul1 li:hover b {
        width: 31px;
        background: var(--publicMainColor);
        margin-right: 20px;
    }

    .ul1 li.on,
    .ul1 li:hover {
        color: var(--publicMainColor);
        margin-left: 20px;
    }
</style>

<body class='bodyClass'>
    <div id="app">
        <!-- 标题 -->

        <el-dialog title="评论" :visible.sync="zuoyetijiaoModal" :modal-append-to-body="false">
            <el-form>
                <!--<el-form-item label="评分">
                    <el-rate style="margin-top: 8%" v-model="zuoyetijiaoCommentbackPingfenNumber" show-score text-color="#ff9900"
                             score-template="{value}">
                    </el-rate>
                </el-form-item>-->
                <el-form-item label="评论信息">
                    <el-input type="textarea" v-model="zuoyetijiaoContent"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="zuoyetijiaoModal = false">取 消</el-button>
                <el-button type="primary" @click="submitZuoyetijiao()">确 定</el-button>
            </div>
        </el-dialog>

        <!-- 标题 -->
        <div class="center-container">
            <!-- 个人中心菜单 config.js-->
            <div class="proleft fl" style="width: 20%;">
                <div class="lefttit">
                    <div class="lefttit-bg">
                        <p class="p2">USER / CENTER</p>
                        <p class="p3">作业提交</p>
                    </div>
                </div>
                <ul class="ul1">
                    <li v-for="(item,index) in centerMenu" v-bind:key="index"
                        :class="item.url=='../zuoyetijiao/list3.html'?'on':''" @click="jump(item.url)">
                        <b></b>{{item.name}}
                    </li>
                </ul>
            </div> <!-- 个人中心菜单 -->
            <div class="right-container sub_borderColor" style="overflow: auto"
                :style='{"padding":"20px","boxShadow":"0px rgba(255,0,0,.8)","margin":"0","backgroundColor":"#fff","borderRadius":"0","borderWidth":"1px","borderStyle":"solid","width":"80%"}'>
                <div
                    style="display: flex;height: 60px;align-items: center;margin-left: 15px;justify-content: space-between">
                    <div style="display: flex;height: 60px;align-items: center;margin-left: 15px;">
                        <div class="thisTableType-search" style="margin-left: 15px;"
                            :style='searchForm.zuoyetijiaoTypes=="" || searchForm.zuoyetijiaoTypes==null?{"color":"red","borderBottom":"1px solid red"}:{"color":"#000"}'>
                            全部
                        </div>
                        <div style="margin-left: 15px;" v-for="item in zuoyetijiaoTypesList" :index="item.codeIndex"
                            class="thisTableType-search"
                            :style='searchForm.zuoyetijiaoTypes==item.codeIndex?{"color":"red","borderBottom":"1px solid red"}:{"color":"#000"}'>
                            {{item.indexName}}
                        </div>
                    </div>
                </div>
                <table class="layui-table" lay-skin="nob">
                    <thead>
                        <tr>
                            <!-- 级联表 -->
                            <th>作业标题</th>
                            <th>作业照片</th>
                            <!-- 当前表 -->
                            <th>作业文件</th>
                            <th>作业成绩</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item,index) in dataList1" v-bind:key="index">
                            <!-- 级联表 -->
                            <td>{{item.zuoyeName}}</td>
                            <td><img :src="baseUrl+item.zuoyePhoto"
                                    style="width: 100px;height: 100px;object-fit: cover;"></td>
                            <td v-if="item.zuoyetijiaoFile" @click="jump(baseUrl+item.zuoyetijiaoFile)"
                                style="color: red">
                                作业文件下载
                            </td>
                            <td v-else>
                                无作业文件
                            </td>
                            <td>{{item.zuoyetijiaoValue}}</td>

                            <td style="width: 100px;">
                                <!--
                            <button @click="jump('../zuoyetijiao/add.html?zuoyetijiaoId='+item.id)" type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">
                                <i class="layui-icon">&#xe642;</i> 修改
                            </button>
                            <button @click="zuoyetijiaoModal = true" type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">
                                <i class="layui-icon">&#xe642;</i> 评论
                            </button>
                        -->
                                <select class="search-input" v-model="chengjidicselected" @change="handleSelectChange">
                                    <option value="">请选择</option>
                                    <option v-for="(item,index) in chengjidic" v-bind:key="index" :value="item.id"
                                        :key="item.id">{{ item.chengjiname }}
                                    </option>
                                </select>
                                <br />
                                <button  @click="changeData(item)" type="button"
                                    class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">
                                    <i class="layui-icon">&#xe640;</i> 批改
                                </button>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div class="pager" id="pager" :style="{textAlign:'center'}"></div>
            </div>
        </div>
    </div>

    <script src="../../xznstatic/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../layui/layui.js"></script>
    <script src="../../js/vue.js"></script>
    <!-- 引入element组件库 -->
    <script src="../../xznstatic/js/element.min.js"></script>
    <!-- 引入element样式 -->
    <link rel="stylesheet" href="../../xznstatic/css/element.min.css">
    <script src="../../js/config.js"></script>
    <script src="../../modules/config.js"></script>
    <script src="../../js/utils.js"></script>

    <script type="text/javascript">

        var chengji='';
        Vue.prototype.myFilters = function (msg) {
            if (msg == null || msg == "") {
                return "";
            } else if (msg.length > 20) {
                msg.replace(/\n/g, "<br>");
                return msg.substring(0, 30) + "......";
            } else {
                return msg.replace(/\n/g, "<br>");
            }
        };
        var vue = new Vue({
            el: '#app',
            data: {
                //小菜单
                centerMenu: centerMenu,
                //项目路径
                baseUrl: "",
                zuoyetijiaoTypesList: [],
                chengjidic: [{
                    id: '2',
                    chengjiname: '差'
                }, {
                    id: '3',
                    chengjiname: '良'
                }, {
                    id: '4',
                    chengjiname: '优'
                }],
                //查询条件
                searchForm: {
                    page: 1
                    , limit: 8
                    , sort: "id"//字段
                    , order: "desc"//asc desc

                    , yonghuId: localStorage.getItem('userid')//只能查询自己
                    , zuoyetijiaoFile: ""
                    , zuoyetijiaoTypes: ""
                },


                dataList: [],
                dataList1: [],
            },
            filters: {
                subString: function (val) {
                    if (val) {
                        val = val.replace(/<[^<>]+>/g, '').replace(/undefined/g, '');
                        if (val.length > 60) {
                            val = val.substring(0, 60);
                            val += '...';
                        }
                        return val;
                    }
                    return '';
                }
            },
            computed: {
            },
            methods: {
                isAuth(tablename, button) {
                    return isFrontAuth(tablename, button);
                },
                jump(url) {
                    jump(url);
                },
                handleSelectChange(event) {
                    const selectedValue = event.target.value;
                    console.log('123',selectedValue);
                    chengji=selectedValue;
                    // 处理选中值的逻辑
                },
                jumpCheck(url, check1, check2) {
                    if (check1 == "2" || check1 == 2) {//级联表的逻辑删除字段[1:未删除 2:已删除]
                        layui.layer.msg("已经被删除", {
                            time: 2000,
                            icon: 2
                        });
                        return false;
                    }
                    if (check2 == "2" || check2 == 2) {//是否下架[1:上架 2:下架]
                        layui.layer.msg("已经下架", {
                            time: 2000,
                            icon: 2
                        });
                        return false;
                    }
                    this.jump(url);
                },
                showContent(content) { alert(content) },
                deleteData(data) {
                    var mymessage = confirm("确定要删除这条数据吗？");
                    if (!mymessage) {
                        alert("已取消操作");
                        return false;
                    }
                    // 获取商品详情信息
                    layui.http.requestJson(`zuoyetijiao/delete`, 'post', [data.id], (res) => {
                        if (res.code == 0) {
                            layer.msg('删除成功', {
                                time: 2000,
                                icon: 6
                            });
                            window.location.reload();
                        } else {
                            layer.msg(res.msg, {
                                time: 2000,
                                icon: 2
                            });
                        }
                    });
                },
                changeData(data) {
                    var mymessage = confirm("确定要提交打分成绩吗？");
                    if (!mymessage) {
                        alert("已取消操作");
                        return false;
                    }
                   var data1={
                    "rowid":data.id,
                    "chengji":chengji,
                   };
                   if (!chengji) {
                        alert("请选择评分");
                        return false;
                    }
                   
                    // 获取商品详情信息
                    layui.http.requestJson(`zuoyetijiao/chengji`, 'post', data1, (res) => {
                        if (res.code == 0) {
                            layer.msg('删除成功', {
                                time: 2000,
                                icon: 6
                            });
                            window.location.reload();
                        } else {
                            layer.msg(res.msg, {
                                time: 2000,
                                icon: 2
                            });
                        }
                    });
                },
            }
        });

        layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery', 'laydate', 'tinymce'], function () {
            var layer = layui.layer;
            var element = layui.element;
            var carousel = layui.carousel;
            var laypage = layui.laypage;
            var http = layui.http;
            var laydate = layui.laydate;
            var tinymce = layui.tinymce;
            window.jQuery = window.$ = jquery = layui.jquery;
            vue.baseUrl = http.baseurl

            localStorage.setItem("goUtl", "./pages/zuoyetijiao/list3.html")

            // var id = http.getParam('id');

            //作业成绩的动态搜素
            $(document).on("click", ".thisTableType-search", function (e) {
                vue.searchForm.zuoyetijiaoTypes = $(this).attr('index');
                pageList1()
            });


            //当前表的 作业成绩 字段 字典表查询
            zuoyetijiaoTypesSelect();
            //当前表的 作业成绩 字段 字典表查询方法
            function zuoyetijiaoTypesSelect() {
                http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=zuoyetijiao_types", 'get', {}, function (res) {
                    if (res.code == 0) {
                        vue.zuoyetijiaoTypesList = res.data.list;
                    }
                });
            }
            // 分页列表
            pageList();

            // 搜索按钮
            jquery('#btn-search').click(function (e) {
                pageList();
            });

            function pageList() {
                // 获取列表数据
                http.request('zuoyetijiao/list', 'get', vue.searchForm, function (res) {
                    vue.dataList = res.data.list;
                    // 分页
                    laypage.render({
                        elem: 'pager',
                        count: res.data.total,
                        limit: vue.searchForm.limit,
                        groups: 3,
                        layout: ["prev", "page", "next"],
                        jump: function (obj, first) {
                            vue.searchForm.page = obj.curr;//翻页
                            //首次不执行
                            if (!first) {
                                http.request('zuoyetijiao/list', 'get', vue.searchForm, function (res1) {
                                    vue.dataList = res1.data.list;
                                })
                            }
                        }
                    });
                });
            }
            pageList1();

            function pageList1() {
                // 获取列表数据
                http.request('zuoyetijiao/list1', 'get', vue.searchForm, function (res) {
                    vue.dataList1 = res.data.list;
                    // 分页
                    laypage.render({
                        elem: 'pager',
                        count: res.data.total,
                        limit: vue.searchForm.limit,
                        groups: 3,
                        layout: ["prev", "page", "next"],
                        jump: function (obj, first) {
                            vue.searchForm.page = obj.curr;//翻页
                            //首次不执行
                            if (!first) {
                                http.request('zuoyetijiao/list', 'get', vue.searchForm, function (res1) {
                                    vue.dataList1 = res1.data.list;
                                })
                            }
                        }
                    });
                });
            }
        });

        window.xznSlide = function () {
            jQuery(".banner").slide({ mainCell: ".bd ul", autoPlay: true, interTime: 5000 });
            jQuery("#ifocus").slide({
                titCell: "#ifocus_btn li",
                mainCell: "#ifocus_piclist ul",
                effect: "leftLoop",
                delayTime: 200,
                autoPlay: true,
                triggerTime: 0
            });
            jQuery("#ifocus").slide({ titCell: "#ifocus_btn li", mainCell: "#ifocus_tx ul", delayTime: 0, autoPlay: true });
            jQuery(".product_list").slide({
                mainCell: ".bd ul",
                autoPage: true,
                effect: "leftLoop",
                autoPlay: true,
                vis: 5,
                trigger: "click",
                interTime: 4000
            });
        };
    </script>
</body>

</html>